package org.example;

import com.rabbitmq.client.AMQP;
import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.lang.reflect.Method;

@Component
public class TestRabbitListener {
    @RabbitListener(bindings = @QueueBinding(
            value = @Queue(name = "direct.queue1", durable = "true"),
            exchange = @Exchange(name = "text.direct", type = ExchangeTypes.DIRECT),
            key = {"red", "blue"}
    ))
    public void listenDirectQueue(String message) {

    }

    public static void main(String[] args) throws NoSuchMethodException {
        Method listenDirectQueue = TestRabbitListener.class.getMethod("listenDirectQueue", new Class[]{String.class});
        RabbitListener annotation = listenDirectQueue.getAnnotation(RabbitListener.class);
        QueueBinding[] bindings = annotation.bindings();

        String[] key = bindings[0].key();

        System.out.println();
    }
}

